package com.ruoyi.testDeal.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.testDeal.domain.equInfo.JkSbInfo;
import com.ruoyi.testDeal.service.IJkSbInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 金属非金属水泵基本参数信息Controller
 *
 * @author ruoyi
 * @date 2024-04-09
 */
@RestController
@RequestMapping("/testDeal/jkSbInfo")
public class JkSbInfoController extends BaseController
{
    @Autowired
    private IJkSbInfoService jkSbInfoService;

    /**
     * 查询金属非金属水泵基本参数信息列表
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkSbInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(JkSbInfo jkSbInfo)
    {
        startPage();
        List<JkSbInfo> list = jkSbInfoService.selectJkSbInfoList(jkSbInfo);
        return getDataTable(list);
    }

    /**
     * 导出金属非金属水泵基本参数信息列表
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkSbInfo:export')")
    @Log(title = "金属非金属水泵基本参数信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, JkSbInfo jkSbInfo)
    {
        List<JkSbInfo> list = jkSbInfoService.selectJkSbInfoList(jkSbInfo);
        ExcelUtil<JkSbInfo> util = new ExcelUtil<JkSbInfo>(JkSbInfo.class);
        util.exportExcel(response, list, "金属非金属水泵基本参数信息数据");
    }

    /**
     * 获取金属非金属水泵基本参数信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkSbInfo:query')")
    @GetMapping(value = "/{sbId}")
    public AjaxResult getInfo(@PathVariable("sbId") Long sbId)
    {
        return success(jkSbInfoService.selectJkSbInfoBySbId(sbId));
    }

    /**
     * 新增金属非金属水泵基本参数信息
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkSbInfo:add')")
    @Log(title = "金属非金属水泵基本参数信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JkSbInfo jkSbInfo)
    {
        return toAjax(jkSbInfoService.insertJkSbInfo(jkSbInfo));
    }

    /**
     * 修改金属非金属水泵基本参数信息
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkSbInfo:edit')")
    @Log(title = "金属非金属水泵基本参数信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JkSbInfo jkSbInfo)
    {
        return toAjax(jkSbInfoService.updateJkSbInfo(jkSbInfo));
    }

    /**
     * 删除金属非金属水泵基本参数信息
     */
    @PreAuthorize("@ss.hasPermi('testDeal:jkSbInfo:remove')")
    @Log(title = "金属非金属水泵基本参数信息", businessType = BusinessType.DELETE)
    @DeleteMapping("/{sbIds}")
    public AjaxResult remove(@PathVariable Long[] sbIds)
    {
        return toAjax(jkSbInfoService.deleteJkSbInfoBySbIds(sbIds));
    }
}
